package com.huawei.hms.support.api.pay.json;

import com.huawei.hms.common.ApiException;
import com.huawei.hms.common.internal.ResponseErrorCode;
import com.huawei.hms.common.internal.TaskApiCall;
import com.huawei.hms.support.api.client.Status;
import com.huawei.hms.support.api.entity.pay.OrderResp;
import com.huawei.hms.support.api.pay.OrderResult;
import com.huawei.hms.support.log.HMSLog;
import com.huawei.hms.utils.JsonUtil;
import o.fjx;

public class OrderTaskApiCall extends TaskApiCall<PayHmsClient, OrderResult> {
    public OrderTaskApiCall(String str, String str2) {
        super(str, str2);
    }

    protected void doExecute(PayHmsClient payHmsClient, ResponseErrorCode responseErrorCode, String str, fjx<OrderResult> o_fjx_com_huawei_hms_support_api_pay_OrderResult) {
        if (responseErrorCode == null) {
            o_fjx_com_huawei_hms_support_api_pay_OrderResult.ॱ(new ApiException(new Status(1)));
        } else if (responseErrorCode.getErrorCode() == 0) {
            HMSLog.i("OrderTaskApiCall", "onResult, success");
            OrderResp orderResp = new OrderResp();
            JsonUtil.jsonToEntity(str, orderResp);
            OrderResult orderResult = new OrderResult(orderResp);
            orderResult.setStatus(new Status(orderResp.getReturnCode(), orderResp.getReturnDesc()));
            o_fjx_com_huawei_hms_support_api_pay_OrderResult.ॱ(orderResult);
        } else {
            HMSLog.i("OrderTaskApiCall", "onResult, returnCode: " + responseErrorCode.getErrorCode());
            o_fjx_com_huawei_hms_support_api_pay_OrderResult.ॱ(new ApiException(new Status(responseErrorCode.getErrorCode(), responseErrorCode.getErrorReason())));
        }
    }
}
